package com.java.controller;

import com.java.entity.PsPoleInfo;
import com.java.entity.RespBean;
import com.java.service.PsPoleInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author caiyuan
 * @version 1.0
 * @Date 2020/6/25 15:12 Dream-Seeker
 * @Description
 */
@RestController
@RequestMapping("/poleInfo")
@Scope("prototype")
public class PsPoleInfoController {
    @Autowired
    PsPoleInfoService psPoleInfoService;

    @GetMapping("/{lineCode}")
    public RespBean getPoleInfoBylineCodes(@PathVariable String lineCode) {
        List<PsPoleInfo> psLineInfo = psPoleInfoService.getPoleInfoBylineCodes(lineCode);
        if (psLineInfo != null) {
            return RespBean.ok("查询成功", psLineInfo);
        } else {
            return RespBean.error("查询失败");
        }

    }
}
